import { handleActions } from "redux-actions";
import { GET_ALL_TYPES } from "../types.js";
import _ from "lodash";

// 初始化数据
const InitData = [
    {
        title: "新鲜蔬果",
        labels: [
            {
                _id: "619eeb6a26db96318ca530bd",
                title: "豆类"
            }
        ]
    }
]


export const allType = handleActions({
    // 获取所有类型
    [GET_ALL_TYPES]: (state, { payload }) => {
        const { data } = payload;
        return _.assign([], state, data)
    },
}, InitData)